#include <iostream>
using namespace std;
//https://www.nowcoder.com/practice/53d110f6cdd14f21af285698f975b59c?tpId=225&tqId=2183645&ru=%2Fpractice%2Fb0423a89826c4d68a3e8b9832a6a1f49&qru=%2Fta%2Fprimary-grammar-cpp%2Fquestion-ranking&sourceUrl=https%3A%2F%2Fwww.nowcoder.com%2Fexam%2Foj
int main() {

    int arr[6] = { 0 };
    int len = sizeof(arr) / sizeof(int);

    for (int i = 0; i < len; i++) {
        cin >> arr[i];
    }
    int max = arr[0]; //最大最小分别都记录第一个数
    int min = arr[0];
    for(int i = 1; i < 6; i++){ //遍历后面5个
        max = arr[i] > max ? arr[i] : max; //依次比较，取较大值
        min = arr[i] < min ? arr[i] : min; //依次比较，取较小值
    }
    cout << min << " " << max << endl;
    return 0;
}



